<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
    <h:head>
        <title>Agenda</title>
    </h:head>
    <h:body>

        <p:layout fullPage="true">

            <p:layoutUnit position="north" size="100" resizable="true" closable="false" collapsible="true"> 
                <h3>Bienvenue <h:outputText value="#{etudiant.nom} "/><h:outputText value="#{etudiant.prenom}"/>
                </h3>

                <p:clock pattern="dd.MM.yyyy HH:mm:ss" mode="server" /> 
                <h:form id="deconnexionForm" rendered="#{etudiant.connected}">
                    <h:commandButton value="Deconnexion" action="#{loginMBean.deconnexion}"/>
                </h:form>
            </p:layoutUnit>


            <h:form id="form">
                <script type="text/javascript">
                    PrimeFaces.locales ['fr'] = {
                        closeText: 'Fermer',
                        prevText: 'Précédent',
                        nextText: 'Suivant',
                        currentText: 'Aujourd\'hui',
                        monthNames: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],
                        monthNamesShort: ['Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Jun', 'Jul', 'Aoû', 'Sep', 'Oct', 'Nov', 'Déc'],
                        dayNames: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],
                        dayNamesShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'],
                        dayNamesMin: ['D', 'L', 'M', 'M', 'J', 'V', 'S'],
                        weekHeader: 'Semaine',
                        firstDay: 1,
                        isRTL: false,
                        showMonthAfterYear: false,
                        yearSuffix: '',
                        timeOnlyTitle: 'Choisir l\'heure',
                        timeText: 'Heure',
                        hourText: 'Heures',
                        minuteText: 'Minutes',
                        secondText: 'Secondes',
                        currentText: 'Maintenant',
                                ampm: false,
                        month: 'Mois',
                        week: 'Semaine',
                        day: 'Jour',
                        allDayText: 'Toute la journée'
                    };
                </script>
                <p:layoutUnit position="center">
                    <p:growl id="messages" showDetail="true" />

                    <p:schedule id="schedule" locale="fr" style="font-size: 10px;height:auto;width: 90%;margin: 0% 2% 0% 2%;" value="#{scheduleController.eventModel}" widgetVar="myschedule">

                        <p:ajax event="dateSelect" listener="#{scheduleController.onDateSelect}" update="eventDetails" oncomplete="PF('eventDialog').show()" />
                        <p:ajax event="eventSelect" listener="#{scheduleController.onEventSelect}" update="eventDetails" oncomplete="PF('eventDialog2').show()" />
                        <p:ajax event="eventMove" listener="#{scheduleController.onEventMove}" update="messages" />
                        <p:ajax event="eventResize" listener="#{scheduleController.onEventResize}" update="messages" />

                    </p:schedule>

                </p:layoutUnit>
                <p:dialog widgetVar="eventDialog" header="Details" showEffect="clip" hideEffect="clip">
                    <h:panelGrid id="eventDetails" columns="2">
                        <h:outputLabel for="title" value="Titre:"/>
                        <p:inputText id="title" value="#{scheduleController.event.title}" required="true"/>

                        <h:outputLabel for="from" value="De:" />
                        <p:calendar id="from" pattern="MM/dd/yyyy HH:mm" value="#{scheduleController.event.startDate}" locale="fr"/>

                        <h:outputLabel for="to" value="A:" />
                        <p:calendar id="to" pattern="MM/dd/yyyy HH:mm" value="#{scheduleController.event.endDate}" locale="fr"/>


                        <h:outputLabel for="allDay" value="Toute la journée:" />
                        <h:selectBooleanCheckbox id="allDay" value="#{scheduleController.event.allDay}" />

                        <h:outputLabel for="location" value="localisation:"/>
                        <h:inputTextarea id="location" value="#{scheduleController.event.data}"/>

                        <p:commandButton type="reset" value="Reset" />
                        <p:commandButton id="addButton" value="Sauvegarder" actionListener="#{scheduleController.addEvent}" oncomplete="PF('myschedule').update();PF('eventDialog').hide();"/>
                    </h:panelGrid>
                </p:dialog>

                <p:dialog widgetVar="eventDialog2" header="Details" showEffect="clip" hideEffect="clip">
                    <h:panelGrid id="updateDetails" columns="2">


                        <p:commandButton type="update" value="Modifier" oncomplete="PF('eventDialog').show();PF('eventDialog2').hide();"/>
                        <p:commandButton id="removeButton" value="Supprimer" actionListener="#{scheduleController.supprimer}" oncomplete="PF('myschedule').update();PF('eventDialog2').hide();"/>
                    </h:panelGrid>
                </p:dialog>

                <p:layoutUnit position="west" style="font-size: 12px;">
                    <h:outputLabel value="nom:"/><h:outputLabel value="#{etudiant.nom}" style="color: blue"/><br/>
                    <h:outputLabel value="prenom:"/><h:outputLabel value="#{etudiant.prenom}" style="color: blue"/><br/>
                    <h:outputLabel value="date naissance:"/><h:outputLabel value="#{etudiant.datenaissance}" style="color: blue"/><br/>
                    <h:outputLabel value="parcours:"/><h:outputLabel value="#{etudiant.idparcours}" style="color: blue" converter="ParcoursConverter"/>
                    <p:separator/>
                    <div align="center">
                        <h:commandButton value="modifier" action="formulaire"/>
                    </div>
                    <p:separator/>
                    <p:separator/>
                    <h3><b>Exportation des données</b></h3>
                    <p:panelGrid columns="4" style="border: none;">
                        <h:commandLink>  
                            <p:graphicImage value="ressources/css/images/pdf.png" />  
                            <p:dataExporter type="pdf" target="schedule" fileName="agenda" pageOnly="true"/>  
                        </h:commandLink>  

                        <h:commandLink>  
                            <p:graphicImage value="ressources/css/images/html.png" />  
                            <p:dataExporter type="html" target="schedule" fileName="agenda" pageOnly="true"/>  
                        </h:commandLink>  

                        <h:commandLink>  
                            <p:graphicImage value="ressources/css/images/xml.png" />  
                            <p:dataExporter type="xml" target="schedule" fileName="agenda" pageOnly="true"/>  
                        </h:commandLink>
                        <h:commandLink>  
                            <p:graphicImage value="ressources/css/images/ical.png" />  
                            <p:dataExporter type="ical" target="schedule" fileName="agenda" pageOnly="true"/>  
                        </h:commandLink>
                    </p:panelGrid>
                </p:layoutUnit>

            </h:form>
        </p:layout>
    </h:body>
</html>
